/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.gar.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "GAR_VEHICULO")
@NamedQueries({@NamedQuery(name = "Vehiculo.findAll", query = "SELECT v FROM Vehiculo v"), @NamedQuery(name = "Vehiculo.findByIdVehiculo", query = "SELECT v FROM Vehiculo v WHERE v.idVehiculo = :idVehiculo"), @NamedQuery(name = "Vehiculo.findByNumeromotor", query = "SELECT v FROM Vehiculo v WHERE v.numeromotor = :numeromotor"), @NamedQuery(name = "Vehiculo.findByPlaca", query = "SELECT v FROM Vehiculo v WHERE v.placa = :placa"), @NamedQuery(name = "Vehiculo.findByMarca", query = "SELECT v FROM Vehiculo v WHERE v.marca = :marca"), @NamedQuery(name = "Vehiculo.findByModelo", query = "SELECT v FROM Vehiculo v WHERE v.modelo = :modelo"), @NamedQuery(name = "Vehiculo.findByColor", query = "SELECT v FROM Vehiculo v WHERE v.color = :color"), @NamedQuery(name = "Vehiculo.findByAño", query = "SELECT v FROM Vehiculo v WHERE v.año = :año"), @NamedQuery(name = "Vehiculo.findByChasis", query = "SELECT v FROM Vehiculo v WHERE v.chasis = :chasis")})
public class Vehiculo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_VEHICULO", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idVehiculo;
    @Column(name = "NUMEROMOTOR", length = 20)
    private String numeromotor;
    @Column(name = "PLACA", length = 50)
    private String placa;
    @Column(name = "MARCA", length = 20)
    private String marca;
    @Column(name = "MODELO", length = 50)
    private String modelo;
    @Column(name = "COLOR", length = 20)
    private String color;
    @Column(name = "AÑO", length = 4)
    private String año;
    @Column(name = "CHASIS", length = 50)
    private String chasis;
    @JoinColumn(name = "ID_VEHICULO", referencedColumnName = "ID_PRENDARIA", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.LAZY)
    private GarantiaPrendaria garantiaPrendaria;

    public Vehiculo() {
    }

    public Vehiculo(Long idVehiculo) {
        this.idVehiculo = idVehiculo;
    }

    public Long getIdVehiculo() {
        return idVehiculo;
    }

    public void setIdVehiculo(Long idVehiculo) {
        this.idVehiculo = idVehiculo;
    }

    public String getNumeromotor() {
        return numeromotor;
    }

    public void setNumeromotor(String numeromotor) {
        this.numeromotor = numeromotor;
    }

    public String getPlaca() {
        return placa;
    }

    public void setPlaca(String placa) {
        this.placa = placa;
    }

    public String getMarca() {
        return marca;
    }

    public void setMarca(String marca) {
        this.marca = marca;
    }

    public String getModelo() {
        return modelo;
    }

    public void setModelo(String modelo) {
        this.modelo = modelo;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getAño() {
        return año;
    }

    public void setAño(String año) {
        this.año = año;
    }

    public String getChasis() {
        return chasis;
    }

    public void setChasis(String chasis) {
        this.chasis = chasis;
    }

    public GarantiaPrendaria getGarantiaPrendaria() {
        return garantiaPrendaria;
    }

    public void setGarantiaPrendaria(GarantiaPrendaria garantiaPrendaria) {
        this.garantiaPrendaria = garantiaPrendaria;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idVehiculo != null ? idVehiculo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vehiculo)) {
            return false;
        }
        Vehiculo other = (Vehiculo) object;
        if ((this.idVehiculo == null && other.idVehiculo != null) || (this.idVehiculo != null && !this.idVehiculo.equals(other.idVehiculo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.gar.be.Vehiculo[idVehiculo=" + idVehiculo + "]";
    }

}
